import 'dart:convert';

/// nickName : "123"
/// userPhone : "17313219419"
/// userEmail : null
/// userHobby : "[\"喜欢的话好\",\"地瓜公对公\",\"大喊大叫点\",\"地大家记得\",\"东看西看记\",\"刺绣看见的\",\"相互的都会\",\"地点解点解\",\"好的弟弟回\",\"都不恐怖东\",\"都好看回东\",\"都不看不到\",\"多厚的波活\",\"多厚的比得\",\"徐局四个班\"]"
/// userUid : "9978888a07afb44b49a9f5c3c1c699b75"
/// userAvatar : "https://img2.baidu.com/it/u=1027827697,3035164934&fm=253&fmt=auto&app=138&f=JPEG?w=889&h=500"
/// token : "60c4477c101c48abb7210fce0ed95df1"
/// chanAddress : "暂未生成"
/// password : "暂未生成"
/// userBirthday : "[\"喜欢的话好\",\"地瓜公对公\",\"大喊大叫点\",\"地大家记得\",\"东看西看记\",\"刺绣看见的\",\"相互的都会\",\"地点解点解\",\"好的弟弟回\",\"都不恐怖东\",\"都好看回东\",\"都不看不到\",\"多厚的波活\",\"多厚的比得\",\"徐局四个班\"]"

UserBean userBeanFromJson(String str) => UserBean.fromJson(json.decode(str));

String userBeanToJson(UserBean data) => json.encode(data.toJson());

class UserBean {
  UserBean({
    String? nickName,
    String? userPhone,
    dynamic userEmail,
    String? userHobby,
    String? userUid,
    String? userAvatar,
    String? token,
    String? chanAddress,
    String? password,
    String? userBirthday,
  }) {
    _nickName = nickName;
    _userPhone = userPhone;
    _userEmail = userEmail;
    _userHobby = userHobby;
    _userUid = userUid;
    _userAvatar = userAvatar;
    _token = token;
    _chanAddress = chanAddress;
    _password = password;
    _userBirthday = userBirthday;
  }

  UserBean.fromJson(dynamic json) {
    _nickName = json['nickName'];
    _userPhone = json['userPhone'];
    _userEmail = json['userEmail'];
    _userHobby = json['userHobby'];
    _userUid = json['userUid'];
    _userAvatar = json['userAvatar'];
    _token = json['token'];
    _chanAddress = json['chanAddress'];
    _password = json['password'];
    _userBirthday = json['userBirthday'];
  }

  String? _nickName;
  String? _userPhone;
  dynamic _userEmail;
  String? _userHobby;
  String? _userUid;
  String? _userAvatar;
  String? _token;
  String? _chanAddress;
  String? _password;
  String? _userBirthday;

  UserBean copyWith({
    String? nickName,
    String? userPhone,
    dynamic userEmail,
    String? userHobby,
    String? userUid,
    String? userAvatar,
    String? token,
    String? chanAddress,
    String? password,
    String? userBirthday,
  }) =>
      UserBean(
        nickName: nickName ?? _nickName,
        userPhone: userPhone ?? _userPhone,
        userEmail: userEmail ?? _userEmail,
        userHobby: userHobby ?? _userHobby,
        userUid: userUid ?? _userUid,
        userAvatar: userAvatar ?? _userAvatar,
        token: token ?? _token,
        chanAddress: chanAddress ?? _chanAddress,
        password: password ?? _password,
        userBirthday: userBirthday ?? _userBirthday,
      );

  String? get nickName => _nickName;

  String? get userPhone => _userPhone;

  dynamic get userEmail => _userEmail;

  String? get userHobby => _userHobby;

  String? get userUid => _userUid;

  String? get userAvatar => _userAvatar;

  String? get token => _token;

  String? get chanAddress => _chanAddress;

  String? get password => _password;

  String? get userBirthday => _userBirthday;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['nickName'] = _nickName;
    map['userPhone'] = _userPhone;
    map['userEmail'] = _userEmail;
    map['userHobby'] = _userHobby;
    map['userUid'] = _userUid;
    map['userAvatar'] = _userAvatar;
    map['token'] = _token;
    map['chanAddress'] = _chanAddress;
    map['password'] = _password;
    map['userBirthday'] = _userBirthday;
    return map;
  }
}
